<script>
	import $store from "@/store/index.js"
	// #ifdef APP-PLUS
	import APPUpdate from '@/uni_modules/zhouWei-APPUpdate/js_sdk/appUpdate';
	// #endif
	import {
		mapActions
	} from "vuex"
	export default {
		onLaunch:async function(options) {
			console.log('App onLaunch')
			// console.log('应用启动路径：', options.path)
			let configInfo = uni.getStorageSync('configInfo') || '';
			if (configInfo) {
				$store.commit('updateConfigState', {
					key: 'configInfo',
					val: configInfo
				})
			}
			let arr = ['authToken', 'userInfo']
			arr.map(key => {
				let val = uni.getStorageSync(key) || ''
				if (val) {
					$store.commit('updateUserState', {
						key,
						val
					})
				}
			})
			this.getConfigInfo()
			
			// 检测新版本
			// #ifdef APP-PLUS
				if(configInfo.app_update_open == 1){
					APPUpdate();
				}
			// #endif
		},
		
		onShow:async function() {

		},
		
		onHide: function() {
			console.log('APP Hide');
		},
		
		methods: {
			...mapActions(['getConfigInfo']),
		}
	}

</script>

<style lang="scss">
	/*每个页面公共css */
	@import "@/common/app.scss";
	@import "@/uni_modules/uview-ui/index.scss";
</style>